﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DSVISUAL.LocalDNS
{
    public class Trackable
    {
        public event EventHandler<bool> SaveHandler;
        public Trackable(INotifyPropertyChanged entity, EntityState state)
        {
            Entity = entity;
            State = state;
        }

        public INotifyPropertyChanged Entity { get; set; }
        public EntityState State { get; set; }
        public void SaveChanges(bool submit = true)
        {
            if (SaveHandler != null)
            {
                SaveHandler(this, submit);
            }
        }
    }

    public enum EntityState
    {
        Detached,
        Unchanged,
        Added,
        Deleted,
        Modified
    }
}
